package com.support.android.myapp3.adapter;

import android.content.Context;
import android.graphics.Color;
import android.graphics.Typeface;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.SimpleAdapter;
import android.widget.TextView;

import com.support.android.myapp3.R;

import java.util.List;
import java.util.Map;

public class TexItemAdapter extends SimpleAdapter {
    List<? extends Map<String, ?>> mdata;

    public TexItemAdapter(Context context, List<? extends Map<String, ?>> data, int resource, String[] from, int[] to) {
        super(context, data, resource, from, to);
        this.mdata = data;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
//        if (convertView == null) {
//            convertView = LinearLayout.inflate(getContext(), R.layout.item_tax_list, null);
//        }

        TextView textView = (TextView) convertView.findViewById(R.id.p_name);
        //获取每次进来时 mData里面存的值  若果相同则变颜色
        //根据Key值取出装入的数据，然后进行比较
        String ss=(String)mdata.get(position).get("TEXT");
        if(ss.equals("五险一金汇缴明细")){
            textView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
        }else if(ss.equals("个人所得税汇缴明细")){
            textView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
        }
        //Log.i("TAG", Integer.toString(position));
        //Log.i("TAG", (String) mData.get(position).get("text"));
        return super.getView(position, convertView, parent);
    }

}
